from apps.common.base.serializers import *
from apps.merchant.addrOfSelfPickup.models import *


class AddrOfSelfPickupBaseSerializer(BaseSerializer):
    class Meta:
        model = AddrOfSelfPickup
        fields = "__all__"


class AddrOfSelfPickupModelSerializer(BaseSerializer):

    shopModel = serializers.SerializerMethodField()
    def get_shopModel(self, obj):
        try:
            return {'id': obj.shop.id, 'name': obj.shop.name}
        except:
            return {}

    class Meta:
        model = AddrOfSelfPickup
        fields = "__all__"
